<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>okChat-登陆页面</title>
</head>
<body>
    <input type="text" autocomplete="off" id="username"/>
    <input type="password" autocomplete="off" id="password"/>
    <button id="login">登陆</button>
    <p id="tip" style="color: red"></p>
    <script src="jquery-3.4.1.min.js"></script>
    <script>
        $(function () {
            $("#login").click(function () {
                let username = $("#username").val().trim();
                let password = $("#password").val().trim();
                if (username === "") {
                    $("#tip").text("账号不能为空");
                    $("#username").focus();
                    return;
                }
                if (password === "") {
                    $("#tip").text("密码不能为空");
                    $("#password").focus();
                    return;
                }
                alert("登陆成功");
                window.location = "chat-list.html";
                sessionStorage.setItem("username", username);
                sessionStorage.setItem("password", password);
            });
        });
    </script>
</body>
</html>
